
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>  
  <head>  
      
    <title>My JSP 'TestLodoop.jsp' starting page</title>  
    <meta http-equiv="pragma" content="no-cache">  
    <meta http-equiv="cache-control" content="no-cache">  
    <meta http-equiv="expires" content="0">      
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  
    <meta http-equiv="description" content="This is my page">  
      
  	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">	
  <script src="${pageContext.request.contextPath}/static/js/pintuer.js"></script>
    <script language="javascript" src="${pageContext.request.contextPath}/static/Lodop6/LodopFuncs.js"></script>  
    <script src="${pageContext.request.contextPath}/static/jquery/jquery-1.8.3.min.js"></script>  
  <!--   <object  id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>   
           <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>  
    </object>  
      
    <script language="javascript">  
        var LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));  
        $(document).ready(function(){  
            if(LODOP == null || (typeof(LODOP.VERSION)=="undefined")){  
                $("#btnPrintView").attr("disabled","disabled");  
                $("#btnPrint").attr("disabled","disabled");  
                $("#btnNext").attr("disabled","disabled");  
            }  
            else{  
                CreatePrinterList();  
            }  
        });  
          
        //打印  
        function print(){  
            document.getElementById("showInstall").innerHTML = "";  
            Create();  
            //LODOP.SET_PRINT_COPIES(2);  
            LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);  
            var code = LODOP.PRINTA();  
            alert(code);  
            var ret = LODOP.GET_VALUE("PRINT_STATUS_OK",code);  
            alert(ret);  
            if(ret){  
                $("#btnNext").attr("disabled","none");  
            }  
            else{  
                document.getElementById("showInstall").innerHTML = "<font color='#FF00FF'>打印失败</font>";  
            }  
        }         
          
          
        //加载打印机  
        function CreatePrinterList(){  
            if (document.getElementById('PrinterList').innerHTML!="") return;  
            LODOP=getLodop();   
            var iPrinterCount=LODOP.GET_PRINTER_COUNT();  
            for(var i=0;i<iPrinterCount;i++){  
      
                var option=document.createElement('option');  
                option.innerHTML=LODOP.GET_PRINTER_NAME(i);  
                option.value=i;  
                document.getElementById('PrinterList').appendChild(option);  
            };    
        };  
          
        //打印预览  
        function preview() {  
            Create();  
            LODOP.SET_PREVIEW_WINDOW(1,0,0,0,0,"");  
            LODOP.PREVIEW();  
        };  
          
        function Create(){  
            LODOP.PRINT_INIT("");     
            LODOP.SET_PRINT_MODE("WINDOW_DEFPRINTER",getSelectedPrintIndex());//设置打印机  
            LODOP.SET_PRINT_MODE("WINDOW_DEFPAGESIZE:"+getSelectedPrintIndex(),"A4");//设置打印纸张为A4  
              
            LODOP.ADD_PRINT_HTM(10,30,700,1080,document.getElementById("tRequest").innerHTML);  
              
            LODOP.NewPage();                              
            CreateDataBill();  
              
            LODOP.NewPage();              
            CreateDataSeal();  
              
            LODOP.NewPage();  
            LODOP.ADD_PRINT_HTM(30,30,700,1080,document.getElementById("tDeal").innerHTML);  
        }  
          
        //选择打印机  
        function getSelectedPrintIndex(){  
            return document.getElementById("PrinterList").value;  
        };  
          
        //法人代表授权书  
        function CreateDataBill() {  
          
            LODOP.ADD_PRINT_TEXT(97,220,500,20,"法人代表授权书");  
            LODOP.SET_PRINT_STYLEA(0,"FontSize",30);  
            LODOP.SET_PRINT_STYLE("FontSize",14);  
            LODOP.ADD_PRINT_TEXT(190,150,300,20,"本授权书声明：总部设在（地址）");  
            LODOP.ADD_PRINT_LINE(205,420, 205, 600,0, 1);  
            LODOP.ADD_PRINT_TEXT(190,600,150,20,"，（公司名称）");  
              
            LODOP.ADD_PRINT_LINE(255,100, 255, 250,0, 1);             
            LODOP.ADD_PRINT_TEXT(240,250,200,20,"公司（法人代表）");  
            LODOP.ADD_PRINT_LINE(255,400, 255, 500,0, 1);  
            LODOP.ADD_PRINT_TEXT(240,500,250,20,"（即下面签字的授权人），");  
              
            LODOP.ADD_PRINT_TEXT(290,100,300,20,"代表本公司授权（被授权人）");  
            LODOP.ADD_PRINT_LINE(315,350, 315, 450,0, 1);  
            LODOP.ADD_PRINT_TEXT(290,450,400,20,"（即下面签字的被授权人）");  
            LODOP.ADD_PRINT_TEXT(340,100,600,20,"为本公司合法代理人，到贵方办理CFCA数字证书相关事宜。");  
              
            LODOP.ADD_PRINT_TEXT(420,150,550,20,"本公司承认该代表所签署文件及提交公司文件的法律效力。");  
              
            LODOP.ADD_PRINT_TEXT(500,100,100,20,"被授权人：");  
            LODOP.ADD_PRINT_TEXT(500,400,100,20,"授权人：");  
            LODOP.ADD_PRINT_TEXT(600,100,200,20,"填写公司名称（公章）");  
            LODOP.ADD_PRINT_TEXT(650,100,200,20,"日期");  
              
        };  
          
        //印章采集页  
        function CreateDataSeal(){  
            LODOP.ADD_PRINT_TEXT(97,250,500,20,"印章采集");  
            LODOP.SET_PRINT_STYLEA(0,"FontSize",30);  
            LODOP.SET_PRINT_STYLE("FontSize",14);  
            LODOP.ADD_PRINT_TEXT(190,100,550,20,"此印章仅用于办理中国大唐集团公司集采平台电子钥匙使用。");  
            LODOP.ADD_PRINT_TEXT(240,100,550,20,"请将公章/合同专用章加盖在以下方框内。");  
            LODOP.ADD_PRINT_RECT(290, 200, 200, 200,0, 1);  
            LODOP.ADD_PRINT_TEXT(540,100,650,20,"此法人签字/印章仅用于办理中国大唐集团公司集采平台电子钥匙使用。");  
            LODOP.ADD_PRINT_TEXT(590,100,650,20,"请将法人签字写在以下方框内，或者将法人印章加盖在以下方框内。");  
            LODOP.ADD_PRINT_RECT(640, 200, 200, 200,0, 1);  
        }  
    </script>   -->
      <script type="text/javascript">
//定义全局变量
var LODOP;
//打印
function toPrint() {
	//识别各种浏览器的实现原理是根据navigator.userAgent返回值识别,如果为chrome浏览器
	if (navigator.userAgent.indexOf('Chrome')>=0){
		var headstr = "<html><head></head><body>";  
		var footstr = "</body>";  
		//获得 print_div   里的所有 html 数据(把要打印的数据嵌套在 一个 div 里，获得 div)
		var printData = document.getElementById("tRequest").innerHTML;
		//获取当前页面的html
		var oldstr = document.body.innerHTML; 
		//把 headstr+printData+footstr 里的数据 复制给 body 的 html 数据 ，相当于重置了 整个页面的 内容
		document.body.innerHTML = headstr+printData+footstr; 
		//使用方法为 window.print() 打印页面上局部的数据 
		window.print(); 
		document.body.innerHTML = oldstr;  
	}else{
		 if(!LODOP){
			//getLodop的任务是判断浏览器的类型并决定采用哪个对象实例，并检测控件是否安装、是否最新版本、并引导安装或升级 
			LODOP=getLodop();
			
		}
		if(LODOP){
			var headstr = "<html><head></head><body>";  
			var footstr = "</body>";  
			var printData = document.getElementById("tRequest").innerHTML;
			var oldstr = document.body.innerHTML;  
			var data = headstr+printData+footstr;  
			LODOP.ADD_PRINT_HTM(20,32,"92%","94%",data);
			LODOP.SET_PRINT_STYLEA(0,"HOrient",3);
			LODOP.SET_PRINT_STYLEA(0,"VOrient",3);
			LODOP.PREVIEW();
		} 
	}
}
//取消
function cancel(){
	window.history.back();
}
 	</script>
      
  </head>  
  <body>  
 

 
    <!-- 以下为具体需要打印的内容 -->  
    <div id ="tRequest" style="">  
      <table style="border-collapse:collapse;width:700px;">  
            
          
        <tr>  
            <td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;" rowspan="4">机构信息</td>  
          
            <td colspan="2" style="border: 1px solid #000;height:25px;width:150px;">中文名称</td>  
            <td colspan="4" style="border: 1px solid #000;">广西梧州XXX农合机构</td>  
        </tr>  
        <tr>  
            <td colspan="2" style="border: 1px solid #000;height:25px;">地址</td>  
            <td colspan="4" style="border: 1px solid #000;">广西梧州市万秀区梧州学院</td>  
        </tr>  
        <tr>  
            <td colspan="2" style="border: 1px solid #000;height:25px;">联系电话</td>  
            <td colspan="4" style="border: 1px solid #000;">0774123456</td>  
        </tr>  
        <tr>  
            <td colspan="2" style="border: 1px solid #000;height:25px;">发票号</td>  
            <td colspan="4" style="border: 1px solid #000;"> ${ticket }</td>  
        </tr>  
        
        
        
        <tr>  
            <td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;" rowspan="${length }">发票详情</td>  
          	<td colspan="2" style="border: 1px solid #000;height:25px;">缴费人姓名</td>  
            <td colspan="1" style="border: 1px solid #000;">个数</td>
            <td colspan="1" style="border: 1px solid #000;">缴费金额</td>
            <td colspan="2" style="border: 1px solid #000;">小计</td>
            
        </tr>
         <c:forEach items="${requestScope.payPerson}" var="payPerson">
        <tr>  
            <td colspan="2" style="border: 1px solid #000;height:25px;">${payPerson.name }</td>  
            <td colspan="1" style="border: 1px solid #000;">1</td>
            <td colspan="1" style="border: 1px solid #000;">${payPerson.payMoney }元</td>
            <td colspan="2" style="border: 1px solid #000;">${payPerson.payMoney }元</td>
        </tr>  
        </c:forEach>
        <tr>  
            <td colspan="2" style="border: 1px solid #000;height:25px;">合计金额</td> 
            <td colspan="4" style="border: 1px solid #000;">${allPrice}元</td>
        </tr>  
       
      
        <tr>  
            <td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;"></td>  
          
            <td colspan="2" style="border: 1px solid #000;height:25px;">  
                操作员：${sessionScope.sysUser.username }  
            </td>  
          <td colspan="4" style="border: 1px solid #000;">打印时间：${nowTime }</td>
        </tr>  
        <tr>  
            <td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;">备注</td>  
          
            <td colspan="6" style="border: 1px solid #000;">  
                如您办理电子钥匙续费，请在此栏注明您所持有的电子钥匙的DN号码：<br><br>  
            </td>  
        </tr>  
      </table>
      
    </div> 
    <div class="btnc">  <a id="btn_print" class="button bg-main icon-check-square-o" data-options="plain:true,iconCls:'icon-print'" onclick="javascript:toPrint();">打印</a></div>
     
  </body>  
</html>  